#include "common.h"
#include "ErrorCode.h"



extern const std::string WORK_ROOT = "/pavt";
const std::string WORK_CONFIG = WORK_ROOT + "/conf";
const std::string VERSION_CONFIG = WORK_CONFIG + "/version.json";
const std::string SYSTEM_CONFIG = WORK_CONFIG + "/config.json";
const std::string SYSTEM_STATUS = WORK_CONFIG + "/status.json";
const std::string OFFLINE_COMMAND_CONFIG = WORK_CONFIG + "/offline/";
const std::string TIMED_COMMAND_CONFIG = WORK_CONFIG + "/timed.bin";

const std::string EXTEND_DEVICE_CONFIG = WORK_CONFIG + "/extendDevice.json";

const std::string NET_ENV_DIR = WORK_CONFIG + "/netEnv/";
const std::string NET_ENV_CONFIG = NET_ENV_DIR + "netEnv.json";
const std::string NETWORK_MANAGE_SCRIPT = WORK_CONFIG + "/network.sh";

const std::string DOWNLOAD_PATHNAME = "/backup/update.tar.gz";
const std::string UPDATE_TEMP_DIR = "/backup/temp";
const std::string FIRMWARE_UPDATE_SCRIPT = UPDATE_TEMP_DIR + "/update.sh";

const std::string MODULE_FIRMWARE_DIR = WORK_CONFIG + "/modfm";


const std::string OFFILE_STATISTIC_DIR = WORK_ROOT + "/sta";
const std::string OFFILE_STATISTIC_FILE = OFFILE_STATISTIC_DIR + "/statistic.txt";


const std::string DEFAULT_UUID = "00000000000000000000000000000000";

const std::string DELETE_STR = "delete";

const std::string DEFAULT_SERVER_ADDRESS = "device.zjpavt.com";



const StringVectorPtr threePhaseVector{new std::vector<std::string>{"A", "B", "C"}};


const StringVectorPtr networkModeVector{new std::vector<std::string>{"ethernet","iot4g", "ethernet1", "auto"}};

const StringVectorPtr doorStatusVector{new std::vector<std::string>{"unknown","open", "close", "error"}};

const StringVectorPtr zeroOrOne{new StringVector{"0", "1"}};


const std::string LOCK_STATUS[]{"locked", "unlocked"};

TaskScheduler longtimeTaskScheduler;


void releaseDynamicFunctor(const Task*& pTask){
    delete reinterpret_cast<ObjectFunction*> (std::get<void*>(*pTask));
    delete pTask;

    pTask = nullptr;
}





